﻿using Cheems.Interface.Models.UserManagement;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace Cheems.Control.Converters
{
    public class UserLevelToForeColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is UserLevel userLevel)
            {
                switch (userLevel)
                {
                    case UserLevel.None:
                        return new SolidColorBrush(Color.FromArgb(0xFF, 0x9E, 0x9E, 0x9E)); // 未知
                    case UserLevel.Tourist:
                        return new SolidColorBrush(Color.FromArgb(0xFF, 0x1F, 0xAB, 0x89)); // 游客
                    case UserLevel.Operator:
                        return new SolidColorBrush(Color.FromArgb(0xFF, 0xE4, 0xF9, 0xF5)); // 操作员
                    case UserLevel.Engineer:
                        return new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x99, 0xFF)); // 工程师
                    case UserLevel.Administrator:
                        return new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x8D, 0x40)); // 管理员
                    case UserLevel.SuperAdministrator:
                        return Brushes.Red; // 超级管理员
                    default:
                        return new SolidColorBrush(Color.FromArgb(0xFF, 0x9E, 0x9E, 0x9E)); // 默认值
                }
            }
            return new SolidColorBrush(Color.FromArgb(0xFF, 0x9E, 0x9E, 0x9E));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // 不需要转换回去
            throw new NotImplementedException();
        }
    }
}
